/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sales.entity;

import accountManagement.entity.Salesman;
import company.entity.Company;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

/**
 *
 * @author ReinForceII
 */
@Entity
public class SalesOrderEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private boolean confirmed;
    private boolean verifiedBySystem;
    private boolean largeOrderConfirmed;
    private double totalAmount;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateConfirmed;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateCreated;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateLastModified;
    @ManyToOne
    private Salesman processedBy;
    @ManyToOne
    private Salesman confirmedBy;
    @OneToMany(cascade = {CascadeType.ALL})
    private List<LineItem> salesOrderLineItems;
    @ManyToOne
    private Company customer;
    @OneToOne
    private SalesQuotation salesQuotation;
    @ManyToOne
    private Salesman largeOrderConfirmedBy;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SalesOrderEntity)) {
            return false;
        }
        SalesOrderEntity other = (SalesOrderEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "salesOrderProcessing.entity.PurchaseOrderEntity[ id=" + id + " ]";
    }

    /**
     * @return the salesOrderLineItems
     */
    public List<LineItem> getSalesOrderLineItems() {
        return salesOrderLineItems;
    }


    /**
     * @return the isVerifiedBySystem
     */
    public boolean isVerifiedBySystem() {
        return verifiedBySystem;
    }

    /**
     * @param isVerifiedBySystem the isVerifiedBySystem to set
     */
    public void setVerifiedBySystem(boolean isVerifiedBySystem) {
        this.verifiedBySystem = isVerifiedBySystem;
    }

    /**
     * @return the isConfirmed
     */
    public boolean isConfirmed() {
        return confirmed;
    }

    /**
     * @param isConfirmed the isConfirmed to set
     */
    public void setConfirmed(boolean isConfirmed) {
        this.confirmed = isConfirmed;
    }

    /**
     * @return the processedBy
     */
    public Salesman getProcessedBy() {
        return processedBy;
    }

    /**
     * @param processedBy the processedBy to set
     */
    public void setProcessedBy(Salesman processedBy) {
        this.processedBy = processedBy;
    }

    /**
     * @return the confirmedBy
     */
    public Salesman getConfirmedBy() {
        return confirmedBy;
    }

    /**
     * @param confirmedBy the confirmedBy to set
     */
    public void setConfirmedBy(Salesman confirmedBy) {
        this.confirmedBy = confirmedBy;
    }

    /**
     * @return the dateCreated
     */
    public Date getDateCreated() {
        return dateCreated;
    }

    /**
     * @param dateCreated the dateCreated to set
     */
    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }


    /**
     * @return the customer
     */
    public Company getCustomer() {
        return customer;
    }

    /**
     * @param customer the customer to set
     */
    public void setCustomer(Company customer) {
        this.customer = customer;
    }

    /**
     * @return the salesQuotation
     */
    public SalesQuotation getSalesQuotation() {
        return salesQuotation;
    }

    /**
     * @param salesQuotation the salesQuotation to set
     */
    public void setSalesQuotation(SalesQuotation salesQuotation) {
        this.salesQuotation = salesQuotation;
    }

    /**
     * @return the totalAmount
     */
    public double getTotalAmount() {
        return totalAmount;
    }

    /**
     * @param totalAmount the totalAmount to set
     */
    public void setTotalAmount(double totalAmount) {
        this.totalAmount = totalAmount;
    }

    /**
     * @param salesOrderLineItems the salesOrderLineItems to set
     */
    public void setSalesOrderLineItems(List<LineItem> salesOrderLineItems) {
        this.salesOrderLineItems = salesOrderLineItems;
    }

    /**
     * @return the dateConfirmed
     */
    public Date getDateConfirmed() {
        return dateConfirmed;
    }

    /**
     * @param dateConfirmed the dateConfirmed to set
     */
    public void setDateConfirmed(Date dateConfirmed) {
        this.dateConfirmed = dateConfirmed;
    }

    /**
     * @return the largeOrderConfirmed
     */
    public boolean isLargeOrderConfirmed() {
        return largeOrderConfirmed;
    }

    /**
     * @param largeOrderConfirmed the largeOrderConfirmed to set
     */
    public void setLargeOrderConfirmed(boolean largeOrderConfirmed) {
        this.largeOrderConfirmed = largeOrderConfirmed;
    }

    /**
     * @return the largeOrderConfirmedBy
     */
    public Salesman getLargeOrderConfirmedBy() {
        return largeOrderConfirmedBy;
    }

    /**
     * @param largeOrderConfirmedBy the largeOrderConfirmedBy to set
     */
    public void setLargeOrderConfirmedBy(Salesman largeOrderConfirmedBy) {
        this.largeOrderConfirmedBy = largeOrderConfirmedBy;
    }

    /**
     * @return the dateLastModified
     */
    public Date getDateLastModified() {
        return dateLastModified;
    }

    /**
     * @param dateLastModified the dateLastModified to set
     */
    public void setDateLastModified(Date dateLastModified) {
        this.dateLastModified = dateLastModified;
    }


    
}
